home *** CD-ROM | disk | FTP | other *** search
- /* 00010000
- * Name: GOPCLI EXEC 00020000
- * VM TCP/IP Network GOPHER Client 00030000
- * Author: Rick Troth, Rice University, Information Systems 00040000
- * Major thanks to Arty Ecock for the wonderful RXSOCKET. 00050000
- * Thanks to Serge Goldstein for help with many things. 00060000
- * Date: 1992-Dec-23 00070000
- */ 00080000
- 00090000
- /* 00100000
- * Copyright 1992 Richard M. Troth. This software was developed 00110000
- * with resources provided by Rice University and is intended 00120000
- * to serve Rice's user community. Rice has benefitted greatly 00130000
- * from the free distribution of software, therefore distribution 00140000
- * of unmodified copies of this material is not restricted. 00150000
- * You may change your own copy as needed. Neither Rice 00160000
- * University nor any of its employees or students shall be held 00170000
- * liable for damages resulting from the use of this software. 00180000
- */ 00190000
- 00200000
- /* 00210000
- * Calls: 00220000
- * RXSOCKET MODULE -- for TCP/IP network services 00230000
- * PIPE MODULE -- for various I/O functions 00240000
- * GLOBALV -- for temp and perm global vars 00250000
- * XMITMSG -- for all message output 00260000
- * VM TCP/IP, V2 or later (through RXSOCKET) 00270000
- * 00280000
- * GOPCLINI EXEC -- to initialize many things 00290000
- * GOPCLITM REXX -- to fetch the first item (a menu) 00300000
- * GOPCLIMB REXX -- to display a menu (from bookmarks) 00310000
- * both of which call other gems 00320000
- * 00330000
- * perm GVs: 00340000
- * HOST - the host to connect to for the root menu 00350000
- * PORT - the port on that host for Gopher service 00360000
- * PATH - the path to the initial menu 00370000
- * NAME - the name of the initial menu 00380000
- * TELNET - the name of the CMS TELNET command (user preference)00390000
- * TN3270 - the name of the command for 3270 telnet connections 00400000
- * VIEWER - the CMS command (XEDIT or BROWSE) used to view a file00410000
- * BOOKMARK. - prefix for all bookmark variables, where what 00420000
- * follows the dot is the name of the bookmark 00430000
- * 00440000
- * temp GVs: 00450000
- * TUBE - the virtual address of a DIALed terminal (not cons) 00460000
- * GOPHER - the IUCV path name and translate table name 00470000
- * PROGID - program name 00480000
- * ITEM - a line of "gopher menu data" for the chosen item 00490000
- * ... 00500000
- */ 00510000
- 00520000
- Trace "OFF" 00530000
- 00540000
- Address "COMMAND" 00550000
- 00560000
- 'SET LANGUAGE (ADD GOP USER' 00570000
- If rc ^= 0 Then Exit rc 00580000
- 00590000
- 'STATE PIPE MODULE *' 00600000
- If rc ^= 0 Then Do 00610000
- qrc = rc 00620000
- /* "You must have CMS Pipelines to run CMS Gopher." */ 00630000
- 'XMITMSG 3 (APPLID GOP CALLER CLI ERRMSG' 00640000
- Exit qrc 00650000
- End /* If .. Do */ 00660000
- 00670000
- /* Thanks to Nick LaFlamme for the linemode catcher. */ 00680000
- 'PIPE COMMAND QUERY DISPLAY' 00690000
- If rc ^= 0 Then Do 00700000
- qrc = rc 00710000
- 'XMITMSG 523 (ERRMSG' /* "Typewriter mode" */ 00720000
- /* "CMS Gopher requires a full-screen terminal." */ 00730000
- 'XMITMSG 926 (APPLID GOP CALLER CLI ERRMSG' 00740000
- Exit qrc 00750000
- End /* If .. Do */ 00760000
- 00770000
- 'STATE RXSOCKET MODULE *' 00780000
- If rc ^= 0 Then Do 00790000
- qrc = rc 00800000
- /* "You must have RXSOCKET to run CMS Gopher." */ 00810000
- 'XMITMSG 1 (APPLID GOP CALLER CLI ERRMSG' 00820000
- Exit qrc 00830000
- End /* If .. Do */ 00840000
- 00850000
- 'STATE TCPIP DATA *' 00860000
- If rc ^= 0 Then Do 00870000
- qrc = rc 00880000
- /* "You must have VM TCP/IP V2 to run CMS Gopher." */ 00890000
- 'XMITMSG 2 (APPLID GOP CALLER CLI ERRMSG' 00900000
- Exit qrc 00910000
- End /* If .. Do */ 00920000
- 00930000
- Parse Arg host port path '(' options ')' . 00940000
- 00950000
- If host = "" & options = "" Then 'GLOBALV SELECT GOPHER GET PATH NAME' 00960000
- Else name = "" 00970000
- 00980000
- /* Initialize some variables */ 00990000
- bookmark = "" 01000000
- bkl = 0 01010000
- tube = "CONS" 01020000
- quit = 0 01030000
- 01040000
- /* process options, if any */ 01050000
- Do While options ^= "" 01060000
- Parse Var options op options 01070000
- Upper op 01080000
- Select /* op */ 01090000
- When Abbrev("TOPIC",op,2) | , 01100000
- Abbrev("PATH",op,1) Then Do 01110000
- path = options 01120000
- options = "" 01130000
- End /* When .. Do */ 01140000
- When Abbrev("TUBE",op,2) Then 01150000
- Parse Var options tube options 01160000
- When Abbrev("BOOKMARK",op,1) | , 01170000
- Abbrev("BKMARK",op,3) Then 01180000
- Parse Var options bookmark options 01190000
- When Abbrev("BOOKLIST",op,5) | , 01200000
- Abbrev("BKLIST",op,3) Then Do 01210000
- bkl = 1 01220000
- End /* When .. Do */ 01230000
- When Abbrev("TITLE",1) Then Do 01240000
- name = options 01250000
- options = "" 01260000
- End /* When .. Do */ 01270000
- Otherwise 'XMITMSG 3 OP (ERRMSG' 01280000
- End /* Select op */ 01290000
- End /* Do While */ 01300000
- 01310000
- /* initialize many GlobalVs, including screen stem */ 01320000
- 'EXEC GOPCLINI' tube 01330000
- 01340000
- /* Now go display first menu or file or bookmark */ 01350000
- Select 01360000
- When bkl Then Call BOOKLIST 01370000
- When bookmark ^= "" Then Call BOOKMARK 01380000
- Otherwise Call SHOWITEM 01390000
- End /* Select */ 01400000
- 01410000
- /* clear some work GlobalVs */ 01420000
- 'GLOBALV SELECT GOPHER SET PROGID' 01430000
- 'GLOBALV SELECT GOPHER SET GOPHER' 01440000
- 'GLOBALV SELECT GOPHER SET TUBE' 01450000
- 'GLOBALV SELECT GOPHER SET ITEM' 01460000
- 'GLOBALV SELECT GOPHER SET COMMAND QUIT' /* no recursion here */ 01470000
- 01480000
- Exit 01490000
- 01500000
- 01510000
- 01520000
- /* ------------------------------------------------------------ SHOWITEM01530000
- */ 01540000
- SHOWITEM: 01550000
- 01560000
- If host = "" Then 'GLOBALV SELECT GOPHER GET HOST' 01570000
- If host = "" Then host = "gopher.tc.umn.edu" 01580000
- 01590000
- If port = "" Then 'GLOBALV SELECT GOPHER GET PORT' 01600000
- If port = "" Then port = 70 01610000
- 01620000
- If name = "" Then Do 01630000
- Parse Value Reverse(path) With name '/' . 01640000
- name = Reverse(name) 01650000
- End /* If .. Do */ 01660000
- 01670000
- If name = "" Then Do 01680000
- 'PIPE COMMAND XMITMSG 4 (APPLID GOP CALLER CLI | VAR NAME' 01690000
- Parse Var name . name 01700000
- End /* If .. Do */ 01710000
- 01720000
- type = Left(path,1) 01730000
- If type = '/' | type = ' ' Then type = '1' 01740000
- 01750000
- item = type || name || '05'x || path || '05'x , 01760000
- || host || '05'x || port || '05'x 01770000
- 'PIPE VAR ITEM | GOPCLITM OPEN | CONSOLE' 01780000
- 01790000
- Return 01800000
- 01810000
- 01820000
- 01830000
- /* ------------------------------------------------------------ BOOKMARK01840000
- * Present the selected bookmark or fall-back to the list of all. 01850000
- */ 01860000
- BOOKMARK: 01870000
- 01880000
- /* if bookmark was specified numeric, just fetch it */ 01890000
- If Datatype(bookmark,'N') Then Do 01900000
- i = Trunc(bookmark) 01910000
- 'PIPE COMMAND GLOBALV SELECT GOPHER GET BOOKMARK.' || i 01920000
- If bookmark.i ^= "" Then Do 01930000
- 'PIPE VAR BOOKMARK.' || i '| GOPCLITM OPEN | CONSOLE' 01940000
- Return 01950000
- End /* If .. Do */ 01960000
- End /* If .. Do */ 01970000
- 01980000
- 01990000
- 02000000
- /* ------------------------------------------------------------ BOOKLIST02010000
- * Present a menu of all of the user's bookmarks. 02020000
- */ 02030000
- BOOKLIST: 02040000
- 02050000
- If name = "" Then Do 02060000
- /* extract personal name from NAMES file */ 02070000
- Parse Value Diag(08,'QUERY USERID') With user . host . '15'x . 02080000
- 'PIPE COMMAND NAMEFIND :USERID' user ':NODE' host , 02090000
- ':NAME | VAR PERSONAL' 02100000
- If rc = 0 & personal ^= "" Then 02110000
- /* make a title line for bookmark list */ 02120000
- 'PIPE COMMAND XMITMSG 40 PERSONAL' , 02130000
- '(APPLID GOP CALLER CLI NOHEADER | VAR NAME' 02140000
- End /* If .. Do */ 02150000
- 02160000
- /* extract bookmarks from GlobalVs */ 02170000
- 'PIPE COMMAND GLOBALV SELECT GOPHER LIST' , 02180000
- '| LOCATE 1-10 / BOOKMARK./ | SPEC /=/ 1 2-* NEXT | VARLOAD' 02190000
- If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0 02200000
- Else bookmark.0 = Trunc(bookmark.0) 02210000
- 02220000
- 'PIPE STEM BOOKMARK. | GOPCLIMB' name '| CONSOLE' 02230000
- If rc ^= 0 Then Return 02240000
- 02250000
- 'GLOBALV SELECT GOPHER GET COMMAND' 02260000
- Parse Upper Var command verb . 02270000
- If Abbrev("QUIT",verb,1) Then Return 02280000
- 02290000
- /* remove any blanked (deleted) bookmarks from the stem */ 02300000
- j = 0 02310000
- 'GLOBALV SELECT GOPHER GET BOOKMARK.0' 02320000
- Do i = 1 to bookmark.0 02330000
- 'GLOBALV SELECT GOPHER GET BOOKMARK.' || i 02340000
- If Symbol("BOOKMARK." || i) = "LIT" | , 02350000
- bookmark.i = "" | , 02360000
- Left(bookmark.i,1) = 'i' Then Iterate 02370000
- j = j + 1 02380000
- bookmark.j = bookmark.i 02390000
- 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || j 02400000
- End 02410000
- bookmark.0 = j 02420000
- 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0' 02430000
- 02440000
- Return 02450000
- 02460000
-